    //2012.09.10
    //Likhodeeva Maria
    //This programme sorts numbers from one file and writes them to the another.

program Sort;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
  i, j, n, t : Integer;
  fin, fout : TextFile;
  mass: array of Integer;

begin
  AssignFile (fin, 'input.txt');
  Reset (fin);
  AssignFile (fout, 'output.txt');
  Rewrite (fout);
  Readln (fin, n);
  SetLength (mass, n);
  for i:=0 to n-1 do
  begin
    read (fin, mass[i]);
  end;
  for j:=1 to n-1 do
  begin
    for i:=0 to n-j-1 do
    begin
      if (mass[i]>mass[i+1]) then
      begin
        t:=mass[i];
        mass[i]:=mass[i+1];
        mass[i+1]:=t;
      end;
    end;
  end;
  for i:=0 to n-1 do
  begin
    write (mass[i], ' ');
    Readln;
  end;
  for i:=0 to n-1 do
  begin
    write (fout, mass[i], ' ');
  end;
  CloseFile (fin);
  CloseFile (fout);
end.
